package services.video;

public class View {
	
	public static void header(String name) {
	    System.out.println();
	    System.out.println("============== " + name + " ==============");
	    System.out.println();
	  }

	public static void display(Feed<? extends Item> feed) {
	    System.out.println(
	        "Showing first " + feed.data.size() + " of " + feed.total + " videos: ");
	    for (Item item : feed.data) {
	      System.out.println();
	      System.out.println("-----------------------------------------------");
	      display(item);
	    }
	  }

	 public static void display(Item item) {
	    System.out.println("Title: " + item.title);
	    System.out.println("Updated: " + item.updated);
	    if (item instanceof Video) {
	      Video video = (Video) item;
	      if(video.id != null) {
	    	  System.out.println("Id: " + video.id);
	      }
	      if (video.description != null) {
	        System.out.println("Description: " + video.description);
	      }
	      if (video.author != null) {
		        System.out.println("Author: " + video.author);
		  }
	      if (!video.tags.isEmpty()) {
	        System.out.println("Tags: " + video.tags);
	      }
	      if (video.player != null) {
	        System.out.println("Play URL: " + video.player.defaultUrl);
	      }
	    }
	  }

}
